home *** CD-ROM | disk | FTP | other *** search
/ World of Education / World of Education.iso / world_p / pcshx10b.zip / PCSHX10B.EXE / GNUFGREP.EXE / GREPDOCS.EXE / FEATURES.DOS < prev    next >
Text File  |  1990-09-06  |  3KB  |  82 lines

  1. FEATURES OF THESE MSDOS VERSIONS OF GNU E?GREP AND FGREP
  2. --------------------------------------------------------
  3.  
  4. UN*X-style wildcards
  5.  
  6.     Command line arguments are expanded in a fashion much closer
  7.     to UN*X conventions than to MSDOS conventions.  The only real
  8.     difference from UN*X is in the treatment of backslashes.
  9.     Backslashes are equivalent to forward slashes.  (MSDOS file
  10.     names cannot contain `*', `?', `[', or `]', and `[abc\-xyz]'
  11.     can be rewritten as `[-abcxyz]', so the loss of the backslash
  12.     escape is not serious.)
  13.  
  14.     GNU glob.c is used to implement this feature.
  15.  
  16.  
  17. GNU getopt
  18.  
  19.     Because I use GNU getopt, the programs are very lenient about
  20.     where you place option flags on the command line.
  21.  
  22.  
  23. `-d expr' option
  24.  
  25.     This option is equivalent to the `-e expr' option, except that
  26.     any surrounding single or double quotes are stripped off
  27.     the expression.  For instance,
  28.  
  29.         egrep * -d 'foo'bar'
  30.  
  31.     searches all files in the working directory for lines
  32.     with the string "foo'bar" in them.  If you use double quotes
  33.     you have to backslash escape them to get them past the
  34.     Microsoft startup code, which uses double quotes for argument
  35.     grouping.  Thus you might write
  36.  
  37.         grep * -d \"foobar.*\"
  38.  
  39.     to check all files in the working directory for lines containing
  40.     the string `foobar.*'.
  41.  
  42.     The latter example points out the reason for including the `-d'
  43.     option.  If you write
  44.  
  45.         grep * -e foobar.*
  46.  
  47.     or even
  48.  
  49.         grep * -e "foobar.*"
  50.  
  51.     the `foobar.*' might be expanded and mess up the command.
  52.     If you use an MSDOS `sh' then you shouldn't ever need the `-d'
  53.     option, but if you use COMMAND.COM, 4DOS, or the like
  54.     you might want to use it.
  55.  
  56.  
  57. True byte count
  58.  
  59.     Some versions of GNU (e?|f)grep programs for MSDOS read the input
  60.     in DOS text mode.  When you use these versions with the `-b' option
  61.     every instance of `\r\n' is counted as a _single_ byte.  I don't
  62.     consider this result to be kosher.  My MSDOS versions read the
  63.     input in binary mode and compute true byte counts.
  64.  
  65.     (For the curious:  fgrep retains the `\r\n' sequences internally,
  66.     but e?grep converts them to `\n'.  The byte count is made correct
  67.     by assigning each each internal character a weight.  All characters
  68.     get a weight of 1, except for `\n' characters that were originally
  69.     `\r\n' sequences; these get a weight of 2.  The byte count is
  70.     computed as a sum of weights.)
  71.  
  72.  
  73. Long line and byte counters
  74.  
  75.     The counters used by the `-b' and `-n' options are long integers,
  76.     so you won't see `3' when you ought to see `65539'.
  77.  
  78.  
  79.  
  80.  
  81.             -- Barry Schwartz, 6 Sept. 1990
  82.